' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.12.16.16.28]) on 2024.02.11 at 23:30 (Coordinated Universal Time)

_title "Rotating Consentric Squares"
' Program by Charlie Veniot

s% = 481
cp% = ( s% - 1 ) / 2
l% = cp%
SCREEN _NEWIMAGE(s%, s%, 17 )

StartDrawingCycle:
  angle% = 0
  direction% = INT( RND*2 )
  for_step% = ( INT( RND * 10 ) + 1 ) * IFF( direction% = 0, 1, -1 )
  for_start% = IFF( direction% = 0, 0, cp% ) 
  for_end% = IFF( direction% = 0, cp%, 0 )
  this_angle_increment% = INT( RND * 72 ) + 1
  COLOR INT( RND * 62 ) + 1
  FOR i% = for_start% TO for_end% STEP for_step%
    li% = l% - i%
    DRAW "B M" + cp% + "," + cp%
    DRAW "B TA " + angle% + " R" + ( li% )
    DRAW "TA " + angle% + "U" + ( li% )
    DRAW "TA " + angle% + "L" + ( 2 * li% )
    DRAW "TA " + angle% + "D" + ( 2 * li% )
    DRAW "TA " + angle% + "R" + ( 2 * li% )
    DRAW "TA " + angle% + "U" + ( li% )
  angle% = angle% + this_angle_increment%
  SLEEP 0.01
  NEXT i%
  SLEEP 1.75
  CLS
GOTO StartDrawingCycle